-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chunk group assignment #697
base: master
Are you sure you want to change the base?
Chunk group assignment #697
Conversation
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
// hash hashes a seed using the Keccak-256 algorithm. The returned value is an integer formed from the | ||
// first 8 bytes of the hash. | ||
func randomInt(seed uint64) uint64 { | ||
hasher := sha3.NewLegacyKeccak256() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mooselumph Is this the correct function to call for a standard keccak hash, or should I instead be calling sha3.New256()
?
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
lightnode/chunkgroup/README.md
Outdated
function: | ||
|
||
``` | ||
chunkGroup := randomInt(rotateLeft(nodeSeed, assignmentIndex) ^ shuffleEpoch) % numberOfChunks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear on which operation is meant by ^
here. If this is bitwise XOR, then it might be constraining the entropy undesirably.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, ^
should be interpreted to mean bitwise XOR.
An alternate strategy might be to just feed the nodeSeed
, assignmentIndex
, and shuffleEpoch
directly into the keccak digest as a byte array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went ahead and implemented the new strategy that appends the values into a byte array and then feeds the entire byte array into the digest.
Signed-off-by: Cody Littley <[email protected]>
Signed-off-by: Cody Littley <[email protected]>
Why are these changes needed?
This is the code for mapping light nodes into chunk groups.
Checks